<?php
  namespace Think\Template\TagLib;
  use Think\Template\TagLib;
 class Nav extends TagLib {
    protected $tags   =  array(
        'nav' => array('close' => 1),
		 'n' => array('attr' => 'type,order,limit,where','close' => 1),
		
		
    );
	
 
  public function _nav($attr,$content) {
        $str = '<?php ';
        $str .= '$result = M("Artype")->where("status = 1")->order("order_id asc")->select();';   
        $str .= 'foreach ($result as $n):';
        $str .= '?>';
        $str .= $content;
        $str .= '<?php endforeach ?>';
 
        return $str;
    }
	public function _n($attr,$content){
		$where = $attr['where']; //查询条件
        $str = '<?php ';
        $str .= '$result = M("Artype")->where("'.$where.'")->order("order_id asc")->select();';   
        $str .= 'foreach ($result as $n):';
        $str .= '?>';
        $str .= $content;
        $str .= '<?php endforeach ?>';
 
        return $str;
		}
}